package com.pro.schedule.controller;

import com.pro.schedule.entity.EventTypeChild;
import com.pro.schedule.service.EventTypeChildService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class EventTypeChildController {
    @Resource
    EventTypeChildService eventTypeChildService;

    @ApiOperation("获取事件子类")
    @PostMapping("/schedule/eventTypeChild/getList")
    public EventTypeChild getEventTypeChildInfo(@RequestBody EventTypeChild eventTypeChild) {
        return eventTypeChildService.getEventTypeChildInfo(eventTypeChild.getEventTypeChildId());
    }

    @ApiOperation("保存或修改事件子类")
    @PostMapping("/schedule/eventTypeChild/saveOrUpdate")
    public String saveOrUpdateEventTypeChild(@RequestBody EventTypeChild eventTypeChild) throws Exception {
        return eventTypeChildService.saveOrUpdateEventTypeChild(eventTypeChild);
    }


    @ApiOperation("删除指定事件子类")
    @PostMapping("/schedule/eventTypeChild/delete")
    public String deleteEventTypeChild(@RequestBody EventTypeChild eventTypeChild) throws Exception {
        return eventTypeChildService.deleteEventTypeChild(eventTypeChild.getEventTypeChildId());
    }
}
